<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<h:html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">
      
<h:head>
	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
	<title>Search Packages</title>
</h:head>


<h:body>
<h:form id="form"> 
	<p:panel>
		<h:link outcome="index" value="Home" /> <br /> 
		<h:link outcome="indexPackages" value="Packages section" /> <br /> 
        <h:link outcome="indexBasicProduct" value="Basic Products section" /> <br /> 
       	<h:link outcome = "createPackage" value = "Go To The Package!"/>
 	</p:panel>
	
		<p:panel header="Packages">
     	<p:dataTable  var="package" value="#{packageBean.packages}" rowKey="#{package.id}" 
     			paginator="true"  
              	
                filteredValue="#{packageBean.filtered}" 
                id="packagesTable"
                emptyMessage="There are NO Packages"
                paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
				rowsPerPageTemplate="5,10,15"
				
				cellSeparator="true"
				resizableColumns="true">  
 
  
        <p:column headerText="ID" sortBy="id" filterBy="id" id="id">  
            #{package.id}  
        </p:column>
        
        <p:column headerText="Residence ID" sortBy="residenceId" filterBy="residenceId" id="residenceId">  
            #{package.residence.id}  
        </p:column>   

        <p:column headerText="Departure Transport ID" sortBy="depTransId" filterBy="depTransId" id="depTransId">  
            #{package.departureTransport.id}
        </p:column> 
            
        <p:column headerText="Return Transport ID" sortBy="retTransId" filterBy="retTransId" id="retTransId">  
            #{package.returnTransport.id}
        </p:column>    

        <p:column headerText="Excursion ID" sortBy="excId" filterBy="excId" id="excId">  
           #{package.excursion.id}
        </p:column> 
        
        
        <p:column headerText="City" sortBy="city" filterBy="city" id="city">  
            #{package.residence.city}
        </p:column>  
        
        <p:column headerText="Transport Type" sortBy="tranType" filterBy="transType" id="transType">  
            #{package.departureTransport.type}
        </p:column>  
        
        
        <p:column headerText="From" sortBy="from" filterBy="from" id="from">  
            #{package.residence.fromDate}
        </p:column>  
        
        <p:column headerText="To" sortBy="to" filterBy="to" id="to">  
            #{package.residence.toDate}
        </p:column>   
        
        <p:column headerText="Excursion" sortBy="excursion" filterBy="excursion" id="excursion">  
            #{package.excursion.description}
        </p:column>  
        
        <p:column headerText="Price" sortBy="price" filterBy="price" id="price" >  
            #{package.price}
        </p:column> 
        
        <p:column style="width:32px"> 
                      <f:facet name="header">
   					<input type='button' value="*" readonly="readonly" title='View Details!' />
   				</f:facet > 
             <p:commandButton id="det"  oncomplete="dialog.show()"
             		update=":form1:genGrid, :form2:resGrid, :form3:depTransGrid, :form4:retTransGrid,
             		:form5:excGrid"   
                     image="ui-icon ui-icon-search" style="width:32px">  
              
                 <f:setPropertyActionListener value="#{package}"  
                     target="#{packageBean.packageSelected}" />  
        </p:commandButton> 
        </p:column>
        
  		<p:column style="width:32px" >
  		              <f:facet name="header">
   					<input type='button' value="*" readonly="readonly" title='Select Package to Modify!' />
   				</f:facet >
  		    <p:commandButton   style="width:32px"
  		    icon="ui-icon-disk"
       		 action="#{packageBean.selectPackage()}" 
       		 type= "submit" ajax="false"
       		 update=":form:packagesTable">
			 <f:setPropertyActionListener value="#{package}"  
                     target="#{packageBean.packageSelected}" />  
			  </p:commandButton>
        </p:column> 
        
        <p:column style="width:32px">
                      <f:facet name="header">
   					<input type='button' value="*" readonly="readonly" title='Delete Package and Restore disponibility for its Basic Products!' />
   				</f:facet >
        
        	<p:commandButton style="width:32px" id="delPack" value="Show Residence" icon="ui-icon-trash"  
              update=":form:packagesTable"  action="#{packageBean.deletePackage()}" type="submit" ajax="false"  >
				 <f:setPropertyActionListener value="#{package}"  
                     target="#{packageBean.packageSelected}" />  
        	</p:commandButton>
        	</p:column>
        	
         <p:column style="width:32px">
                      <f:facet name="header">
   					<input type='button' value="*" readonly="readonly" title='Delete Package!' />
   				</f:facet >
        
        	<p:commandButton style="width:32px" id="forceDelPack" value="Show Residence" icon="ui-icon-trash"  
              update=":form:packagesTable"  action="#{packageBean.forceDelete()}" type="submit" ajax="false"  >
				 <f:setPropertyActionListener value="#{package}"  
                     target="#{packageBean.packageSelected}" />  
        	</p:commandButton>
        
        </p:column>   
      
        
   </p:dataTable>
   </p:panel>
 </h:form>
 
 	
	<p:dialog id="dialog" header="Details" widgetVar="dialog" resizable="true"  
              width="600" height="400"  showEffect="exlpode" hideEffect="explode" closeOnEscape="true">
	<h:form id="form1">
		<p:panel header="General Details">
	        <h:panelGrid  id="genGrid" columns="2" >
	        		
	        		<h:outputLabel>Id*:</h:outputLabel>
					<h:outputText value="#{packageBean.packageSelected.id}"  />
				
	        
					<h:outputLabel>Available*:</h:outputLabel>
					<p:selectBooleanCheckbox value="#{packageBean.packageSelected.available}" disabled="true" />
				
					<h:outputLabel>Disponibility*:</h:outputLabel>
					<h:outputText value="#{packageBean.packageSelected.disponibility}" />
		            
		
					<h:outputLabel>Price*:</h:outputLabel>
					<h:outputText value="#{packageBean.packageSelected.price}" />
			
	

					<h:outputLabel>Discount(%)*:</h:outputLabel>
					<h:outputText value="#{packageBean.packageSelected.discount}" />
					
			
		
		</h:panelGrid>
		</p:panel>
</h:form>


			<h:form id="form2">
			<p:panel header="Residence Details">
	        <h:panelGrid  id="resGrid" columns="2" >  
	        
	        	<h:outputLabel>Id*:</h:outputLabel>
				<h:outputText value="#{packageBean.packageSelected.residence.id}"  /> 
	   
				<h:outputLabel>Available*:</h:outputLabel>
				<p:selectBooleanCheckbox value="#{packageBean.packageSelected.residence.available}" disabled="true" />
			
				<h:outputLabel>Disponibility*:</h:outputLabel>
				<h:outputText value="#{packageBean.packageSelected.residence.disponibility}" />
	            
	
				<h:outputLabel>Price*:</h:outputLabel>
				<h:outputText value="#{packageBean.packageSelected.residence.price}" />
			
				
			
				<h:outputLabel>Residence Type*:</h:outputLabel>
				<h:outputText value="#{packageBean.packageSelected.residence.type}" />  
				
				
				
				<h:outputLabel>Name*:</h:outputLabel>
				<h:outputText value="#{packageBean.packageSelected.residence.residenceName}" /> 
				
				<h:outputLabel>City*:</h:outputLabel>
				<h:outputText value="#{packageBean.packageSelected.residence.city}" /> 
				
				<h:outputLabel>Country*:</h:outputLabel>
				<h:outputText value="#{packageBean.packageSelected.residence.country}" />
				
	
				<h:outputLabel>Address*:</h:outputLabel>
				<h:outputText value="#{packageBean.packageSelected.residence.address}" />
		
				<h:outputLabel>From*:</h:outputLabel>
				<p:calendar value="#{packageBean.packageSelected.residence.fromDate}" disabled="true" />
				
		
				<h:outputLabel>To*:</h:outputLabel>
				<p:calendar value="#{packageBean.packageSelected.residence.toDate}" disabled="true"/>
				
		
		
				<h:outputLabel >Site:</h:outputLabel>
				<h:outputText value="#{packageBean.packageSelected.residence.site}"/> 
		
	
				<h:outputLabel>Phone:</h:outputLabel>
				<h:outputText value="#{packageBean.packageSelected.residence.phoneNumber}"/>
		
	
				<h:outputLabel>Rooms*:</h:outputLabel>
				<h:outputText value="#{packageBean.packageSelected.residence.rooms}"/> 
		
				<h:outputLabel>Beds*:</h:outputLabel>
				<h:outputText value="#{packageBean.packageSelected.residence.rooms}"/>
			
				<h:outputLabel>Stars:</h:outputLabel>
				<p:rating value="#{packageBean.packageSelected.residence.stars}" disabled="true"/>  
	  
	   
	        </h:panelGrid> 
	        </p:panel>
	        </h:form>

	        <h:form id="form3">
	        <p:panel header=" Departure Transport Details">
	        <h:panelGrid  id="depTransGrid" columns="2" >   
	        
	       			<h:outputLabel>Id*:</h:outputLabel>
					<h:outputText value="#{packageBean.packageSelected.departureTransport.id}"  /> 
	   
	   
								
					<h:outputLabel>Available*:</h:outputLabel>
					<p:selectBooleanCheckbox 
					value="#{packageBean.packageSelected.departureTransport.available}" disabled="true"/>
					
	
					<h:outputLabel>Disponibility*:</h:outputLabel>
					<h:outputText value="#{packageBean.packageSelected.departureTransport.disponibility}" />
	
					<h:outputLabel>Price*:</h:outputLabel>
					<h:outputText value="#{packageBean.packageSelected.departureTransport.price}"/>
					

					<h:outputLabel>Transport Type*:</h:outputLabel>
					<h:outputText value="#{packageBean.packageSelected.departureTransport.type}" />
				
		
					<h:outputLabel>Number of Passengers*:</h:outputLabel>
					<h:outputText value="#{packageBean.packageSelected.departureTransport.passengers}" />

					<h:outputLabel>Class*:</h:outputLabel>
					<h:outputText value="#{packageBean.packageSelected.departureTransport.classNumber}" />
	
					<h:outputLabel>From (Place)*:</h:outputLabel>
					<h:outputText value="#{packageBean.packageSelected.departureTransport.fromPlace}" />
	
					<h:outputLabel>To (Place)*:</h:outputLabel>
					<h:outputText value="#{packageBean.packageSelected.departureTransport.toPlace}" />
	
					<h:outputLabel>Departure Date*:</h:outputLabel>
					<p:calendar value="#{packageBean.packageSelected.departureTransport.departureDate}" disabled="true"  />
				
	
					<h:outputLabel>Departure Time*:</h:outputLabel>
					<p:calendar value="#{packageBean.packageSelected.departureTransport.departureTime}"  pattern="HH:mm" timeOnly="true" disabled="true"/>					
					
					<h:outputLabel>Departure Company:</h:outputLabel>
					<h:outputText value="#{packageBean.packageSelected.departureTransport.company}" />
					
					<h:outputLabel>Flight ID:</h:outputLabel>
					<h:outputText  value="#{packageBean.packageSelected.departureTransport.flightId}" />
				
	        </h:panelGrid> 
	        </p:panel>
	     </h:form>
	     

			<h:form id="form4">
			<p:panel header="Return Transport Details" >
	        <h:panelGrid header="Return Transport Details" id="retTransGrid" columns="2" >   
	   
	   
	    	    	<h:outputLabel>Id*:</h:outputLabel>
					<h:outputText value="#{packageBean.packageSelected.returnTransport.id}"  /> 
	   
								
					<h:outputLabel>Available*:</h:outputLabel>
					<p:selectBooleanCheckbox  
					value="#{packageBean.packageSelected.returnTransport.available}" disabled="true"/>
					
	
					<h:outputLabel>Disponibility*:</h:outputLabel>
					<h:outputText value="#{packageBean.packageSelected.returnTransport.disponibility}" />
	
					<h:outputLabel>Price*:</h:outputLabel>
					<h:outputText value="#{packageBean.packageSelected.returnTransport.price}" />
					

					<h:outputLabel>Transport Type*:</h:outputLabel>
					<h:outputText value="#{packageBean.packageSelected.returnTransport.type}" />
				
		
					<h:outputLabel>Number of Passengers*:</h:outputLabel>
					<h:outputText value="#{packageBean.packageSelected.returnTransport.passengers}" />

					<h:outputLabel>Class*:</h:outputLabel>
					<h:outputText id="classNumber" value="#{packageBean.packageSelected.returnTransport.classNumber}"/>
	
					<h:outputLabel>From (Place)*:</h:outputLabel>
					<h:outputText value="#{packageBean.packageSelected.returnTransport.fromPlace}" />
	
					<h:outputLabel>To (Place)*:</h:outputLabel>
					<h:outputText  value="#{packageBean.packageSelected.returnTransport.toPlace}" />
	
					<h:outputLabel>Departure Date*:</h:outputLabel>
					<p:calendar value="#{packageBean.packageSelected.returnTransport.departureDate}" disabled="true"  id="departureDate"/>
				
	
					<h:outputLabel>Departure Time*:</h:outputLabel>
					<p:calendar value="#{packageBean.packageSelected.returnTransport.departureTime}"  pattern="HH:mm" timeOnly="true" disabled="true"/>					
					
					<h:outputLabel>Departure Company:</h:outputLabel>
					<h:outputText value="#{packageBean.packageSelected.returnTransport.company}" />
					
					<h:outputLabel>Flight ID:</h:outputLabel>
					<h:outputText value="#{packageBean.packageSelected.returnTransport.flightId}" />
				
	        </h:panelGrid> 
	        </p:panel>
	        </h:form>

	     

			<h:form id="form5">
			<p:panel header=" Excursion Details">
	        <h:panelGrid id="excGrid" columns="2"  > 
	          	
	              	<h:outputLabel>Id*:</h:outputLabel>
					<h:outputText value="#{packageBean.packageSelected.excursion.id}"  /> 
	   
	          		
	          		
					<h:outputLabel>Available*:</h:outputLabel>
					<p:selectBooleanCheckbox value="#{packageBean.packageSelected.excursion.available}" disabled="true" />
					
				
					<h:outputLabel>Disponibility*:</h:outputLabel>
					<h:outputText value="#{packageBean.packageSelected.excursion.disponibility}"/>
			
					<h:outputLabel>Price*:</h:outputLabel>
					<h:outputText value="#{packageBean.packageSelected.excursion.price}"/>
			
					<h:outputLabel>Type*:</h:outputLabel>
					<h:outputText value="#{packageBean.packageSelected.excursion.type}" />
			
					<h:outputLabel>Description*:</h:outputLabel>
					<h:outputText value="#{packageBean.packageSelected.excursion.description}" rows="6" cols="33" />
			
					<h:outputLabel >Date*:</h:outputLabel>
					<p:calendar value="#{packageBean.packageSelected.excursion.date}"  disabled="true"/>
		
					<h:outputLabel>Start Time*:</h:outputLabel>
					<p:calendar value="#{packageBean.packageSelected.excursion.startTime}"  pattern="HH:mm" timeOnly="true" disabled="true"/>
		
					<h:outputLabel>End Time*:</h:outputLabel>
					<p:calendar value="#{packageBean.packageSelected.excursion.endTime}"  pattern="HH:mm" timeOnly="true" disabled="true"/>
								
					
	        </h:panelGrid> 
	        </p:panel>
	        </h:form>
	     </p:dialog>
	  

	
	
</h:body>
</h:html>